// app.js
App({
  globalData: {
    userInfo: null,
    userType: null, // 'student' | 'teacher'
    token: null
  },
  onLaunch() {
    console.log('明塾小程序启动')
    // 检查登录状态
    const token = wx.getStorageSync('token')
    if (token) {
      this.globalData.token = token
      const userInfo = wx.getStorageSync('userInfo')
      this.globalData.userInfo = userInfo
      this.globalData.userType = userInfo?.type || 'student'
    }
  }
})